home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Over 1,000 Windows 95 Programs
/
Over 1000 Windows 95 Programs (Microforum) (Disc 2).iso
/
1180
/
macros.tx_
< prev
next >
Wrap
Text File
|
1997-04-17
|
4KB
|
133 lines
The following three macros are Word For Windows macros
that you can play with. They illustrate how to use the
new DDE protocol. If you are not familiar with programming
Word For Windows macros, its best not to try to get involved
with this file.
==============================================================
This is the SelectNameGetAddress macro. It should be self
explanatory if you run it.
Sub MAIN
On Error Goto Done
ChanNum = DDEInitiate("address", "DDE.ADD")
NotDone = 1
Dim NumNames$(5)
Dim ListName$(64)
NumNames$ = DDERequest$(ChanNum, "c [Current List]")
ListName$ = "List: " + DDERequest$(ChanNum, "l")
Dim ListBox1$(Val(NumNames$))
ListBox1$(0) = ""
wItems = Val(NumNames$)
ListBox1$(0) = DDERequest$(ChanNum, "uf [Current List] %NAME")
ctr = 1
While ctr < wItems
ListBox1$(ctr) = DDERequest$(ChanNum, "un")
ctr = ctr + 1
Wend
Begin Dialog UserDialog 420, 160, "Choose Name"
OKButton 320, 30, 88, 21
CancelButton 320, 59, 88, 21
Text 20, 12, 380, 12, ListName$
ListBox 20, 30, 289, 124, ListBox1$(), .Index
End Dialog
Dim TestDialog As UserDialog
Dialog TestDialog
If ListBox1$(TestDialog.Index) <> "" Then Insert DDERequest$(ChanNum, "uf [Current List] " + \
"[" + ListBox1$(TestDialog.Index) + "]" + \
"%NAME%CR" + \
"%A1%CR%A2%CR%A3%CR" + \
"%CITY% %ST%, %ZIP%CR")
Done:
DDETerminate(ChanNum)
End Sub
=========================================================================
This is a macro that gets all the names from a specified list.
Sub MAIN
Dim Data$(500)
ChanNum = DDEInitiate("address", "DDE.ADD")
Insert DDERequest$(ChanNum, "uf [All Addresses] [A Luther] %SAL% %FN" + \
"% %LN%CR%A1" + \
"% %A2%CR%A3%CITY% %ST%, %ZIP%CR" + \
"%Home Phone: %HP%CR" + \
"%Work Phone: %WP% %Ext. %WE%CR" + \
"%Fax Phone: %FP%CR" + \
"%His Birthday: %HISB%CR" + \
"%Her Birthday: %HERB%CR" + \
"%Anniversary: %AN%CR" + \
"%Comment: %CMT%CR%CR")
NotDone = 1
While NotDone
Data$ = DDERequest$(ChanNum, "un")
If Data$ = "" Then NotDone = 0 Else Insert Data$
Wend
DDETerminate(ChanNum)
End Sub
=========================================================================
Sub MAIN
rem This macro is used with Address Manager to get the names of the
rem User defined lists associated with the current file. The lists are shown
rem in a listbox. See DDE.TXT for details on the DDE protocol.
On Error Goto Done
ChanNum = DDEInitiate("address", "MYNAMES2.ADD")
NotDone = 1
Dim NumLists$(5)
Dim ListName$(64)
NumLists$ = DDERequest$(ChanNum, "gcl")
ListName$ = DDERequest$(ChanNum, "gfl")
Dim ListBox1$(Val(NumLists$))
ListBox1$(0) = ListName$
ctr = 0
While ListBox1$(ctr) <> ""
ctr = ctr + 1
ListBox1$(ctr) = DDERequest$(ChanNum, "gnl")
Wend
Begin Dialog UserDialog 420, 160, "Choose List"
OKButton 320, 30, 88, 21
CancelButton 320, 59, 88, 21
Text 20, 12, 380, 12, "User Lists"
ListBox 20, 30, 289, 124, ListBox1$(), .Index
End Dialog
Dim TestDialog As UserDialog
Dialog TestDialog
Done:
DDETerminate(ChanNum)
End Sub